import { ref } from 'vue'
import { defineStore } from 'pinia'
import { getUserAPI } from '@/apis/user'

export const useUserStore = defineStore('user', () => {
    // state
    const userInfo = ref([])

    //获取user数据和设置user信息
    const getUserData = async () => {
        const res = await getUserAPI()
        userInfo.value = res.data.data

    }

    return {
        userInfo,
        getUserData,
    }
})